#ifndef CREATEACCOUNTDATADIALOG_H
#define CREATEACCOUNTDATADIALOG_H


#include <QDialog>
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QPlainTextEdit>
#include <QPushButton>

#include <crypto/ciphermanager.h>
#include <crypto/securedatamapitem.h>
#include <utils/popup.h>
#include "utils/clipboardwatcher.h"

namespace data_display {
class accountDataDialog : public QDialog {
	Q_OBJECT
public:
	accountDataDialog(utils::ClipboardWatcher &clipboard_watcher, QWidget *parent = nullptr,
	                  const std::shared_ptr<crypto::cipherManager> &manager = nullptr);

	accountDataDialog(utils::ClipboardWatcher& clipboard_watcher, QWidget *parent = nullptr,
	                  crypto::SecureDataMapItem* account = nullptr);

signals:
	void sendData(const crypto::SecureDataMapItem &user);

	void sendDataCopied();

private slots:
	void showPass();

	void updateData();

	void createData();

	void generatePassword();

	void isPasswordSecure(const QString& password);

protected:
	bool eventFilter(QObject *obj, QEvent *event) override;
private:
	QLineEdit *_serviceNameEdit;
	QLineEdit *_loginEdit;
	QLineEdit *_passwordEdit;

	QPlainTextEdit *_secureNoteEdit;

	QLabel *_serviceNameLabel;
	QLabel *_loginLabel;
	QLabel *_passwordLabel;
	QLabel *_secureNoteLabel;
	QLabel *_passwordWarning;

	QPushButton *_generatePasswordButton;

	QDialogButtonBox *_buttonBox;

	std::shared_ptr<crypto::cipherManager> _manager;

	std::shared_ptr<crypto::SecureDataMapItem> _item;

	bool checkLineEditsNonEmpty();

	utils::PopUp *_pop_up;
	utils::ClipboardWatcher& _clipboard_watcher;

	bool waitForDoubleClick;

};
}



#endif //CREATEACCOUNTDATADIALOG_H
